<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE HTML>
<html>
<head>
    <title>Title</title>
    <meta charset="UTF-8">
    <script type="text/javascript" src="jquery-1.10.2.min.js"></script>
</head>
<body>
<form action="update.html" method="post">
    <input type="hidden" name="id" value="${host.id}">
<table>
    <tr>
        <td>域名</td>
        <td><input name="host" value="${host.host}"></td>
    </tr>
    <tr>
        <td>端口</td>
        <td><input name="port" value="${host.port}"></td>
    </tr>
    <tr>
        <td>IP</td>
        <td><input name="ip" value="${host.ip}"></td>
    </tr>
    <tr>
        <td>状态</td>
        <td>
            <input type="radio" value="1" name="status" ${host.status==1?'checked':''}>启用
            <input type="radio" value="0" name="status" ${host.status==0?'checked':''}>禁用
        </td>
    </tr>
    <tr>
        <td colspan="2" align="center"><input type="button" value="提交" id="btn">${message}</td>
    </tr>
</table>
</form>
<script type="text/javascript">
    $(function(){
        $("#btn").click(function(){
            $.ajax({
                url:"check.html",
                data:$("form").serialize(),
                method:"post",
                success:function(json){
                    if(!json.status){
                        alert(json.message)
                    }else{
                        $("form").submit()
                    }
                }
            })
        });
    })
</script>
</body>
</html>
